ABC135 B - 0 or 1 Swap
https://atcoder.jp/contests/abc135/tasks/abc135_b
提出
code: python
import copy
n = int(input())
p = list(map(int, input().split()))
p2 = copy.copy(p)
p2.sort()
diff = 0
for i in range(n):
if (p
i
!= p2
i
):
diff += 1
if (diff > 2):
print("NO")
else:
print("YES")